package cn.com.cloudpioneer.evaluate.controller;

import cn.com.cloudpioneer.evaluate.model.TaskModel;
import cn.com.cloudpioneer.evaluate.service.TaskService;
import cn.com.cloudpioneer.evaluate.utils.CustomException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @auther maruikai
 * @create 2023/9/13-17:28
 */
@RestController
@RequestMapping("/api/xgs/task")
@Api(tags = "任务管理")
public class TaskController extends BaseController  {

    @Autowired
    private TaskService taskService;

    @RequestMapping(value = "/set", method = RequestMethod.POST)
    @ApiOperation(value = "添加任务")
    public Object setTask(@RequestBody TaskModel taskModel) throws CustomException {
        return taskService.setTask(taskModel);
    }

    @RequestMapping(value = "/del", method = RequestMethod.POST)
    @ApiOperation(value = "删除任务")
    public Object delTask(@RequestParam String taskId) throws CustomException {
        return taskService.delTask(taskId);
    }

    @RequestMapping(value = "/get_list", method = RequestMethod.POST)
    @ApiOperation(value = "获取列表")
    public Object getTaskList(@RequestParam String itemId) throws CustomException {
        return taskService.getTaskList(itemId);
    }

    @RequestMapping(value = "/get_child_list", method = RequestMethod.POST)
    @ApiOperation(value = "获取二级列表")
    public Object getTaskChileList(@RequestParam String taskId) {
        return taskService.getTaskChileList(taskId);
    }


    @RequestMapping(value = "/target_list",method = RequestMethod.POST)
    @ApiOperation("获取指标列表")
    public Object getTargetList(@RequestParam String taskId) {
        return taskService.getTargetList(taskId);
    }

}
